/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.etfbl.healt;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Zoran
 */
@Entity
@Table(name = "latest_activity")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LatestActivity.findAll", query = "SELECT l FROM LatestActivity l"),
    @NamedQuery(name = "LatestActivity.findById", query = "SELECT l FROM LatestActivity l WHERE l.id = :id"),
    @NamedQuery(name = "LatestActivity.findByUpdatedate", query = "SELECT l FROM LatestActivity l WHERE l.updatedate = :updatedate"),
    @NamedQuery(name = "LatestActivity.findByHeartRate", query = "SELECT l FROM LatestActivity l WHERE l.heartRate = :heartRate"),
    @NamedQuery(name = "LatestActivity.findByOxigenLevel", query = "SELECT l FROM LatestActivity l WHERE l.oxigenLevel = :oxigenLevel"),
    @NamedQuery(name = "LatestActivity.findByBloodPresure", query = "SELECT l FROM LatestActivity l WHERE l.bloodPresure = :bloodPresure")})
public class LatestActivity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Update_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updatedate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Heart_Rate")
    private long heartRate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Oxigen_Level")
    private long oxigenLevel;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Blood_Presure")
    private long bloodPresure;
    @JoinColumn(name = "Device_has_Patient_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private DeviceHasPatient devicehasPatientid;

    public LatestActivity() {
    }

    public LatestActivity(Integer id) {
        this.id = id;
    }

    public LatestActivity(Integer id, Date updatedate, long heartRate, long oxigenLevel, long bloodPresure) {
        this.id = id;
        this.updatedate = updatedate;
        this.heartRate = heartRate;
        this.oxigenLevel = oxigenLevel;
        this.bloodPresure = bloodPresure;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getUpdatedate() {
        return updatedate;
    }

    public void setUpdatedate(Date updatedate) {
        this.updatedate = updatedate;
    }

    public long getHeartRate() {
        return heartRate;
    }

    public void setHeartRate(long heartRate) {
        this.heartRate = heartRate;
    }

    public long getOxigenLevel() {
        return oxigenLevel;
    }

    public void setOxigenLevel(long oxigenLevel) {
        this.oxigenLevel = oxigenLevel;
    }

    public long getBloodPresure() {
        return bloodPresure;
    }

    public void setBloodPresure(long bloodPresure) {
        this.bloodPresure = bloodPresure;
    }

    public DeviceHasPatient getDevicehasPatientid() {
        return devicehasPatientid;
    }

    public void setDevicehasPatientid(DeviceHasPatient devicehasPatientid) {
        this.devicehasPatientid = devicehasPatientid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LatestActivity)) {
            return false;
        }
        LatestActivity other = (LatestActivity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "net.etfbl.healt.LatestActivity[ id=" + id + " ]";
    }
    
}
